package cn.wetcland.urban.admin.controller;

import cn.wetcland.urban.admin.service.UtCarService;
import cn.wetcland.urban.admin.service.UtCustomerService;
import cn.wetcland.urban.admin.service.UtDriverService;
import cn.wetcland.urban.common.AjaxResponse;
import cn.wetcland.urban.generator.domain.UtCar;
import cn.wetcland.urban.generator.domain.UtDriver;
import cn.wetcland.urban.generator.dto.BaseConditionSearchDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/verify")
public class VerifyController {

    @Resource
    public UtDriverService driverService;

    @Resource
    public UtCustomerService customerService;

    @Resource
    public UtCarService carService;

    // 司机审核列表
    @GetMapping("/verifyDriverList")
    public AjaxResponse verifyDriverList(BaseConditionSearchDTO searchDTO) {
        Page<UtDriver> driverList = driverService.verifyDriverList(searchDTO);
        return AjaxResponse.success(driverList);
    }


    // 车辆审核列表
    @GetMapping("/verifyCarList")
    public AjaxResponse verifyCarList(BaseConditionSearchDTO searchDTO) {
        Page<UtCar> carList = carService.verifyCarList(searchDTO);
        return AjaxResponse.success(carList);
    }

    @PutMapping("/verifyDriver/{driverId}")
    public AjaxResponse verifyDriver(@PathVariable Long driverId) {
        driverService.verifyDriver(driverId);
        return AjaxResponse.success();
    }

    @PutMapping("/verifyCar/{carId}")
    public AjaxResponse verifyCustomer(@PathVariable Long carId) {
        carService.verifyCar(carId);
        return AjaxResponse.success();
    }

}
